package com.school.lab.dao.impl;

import java.util.List;

import org.hibernate.CacheMode;
import org.hibernate.Query;

import com.school.lab.common.dao.impl.GenericDaoHibernateImpl;
import com.school.lab.dao.MoudelDao;
import com.school.lab.domain.Moudel;

/**
 * @author Beson.Sun
 *
 */
public class MoudelDaoImpl extends GenericDaoHibernateImpl<Moudel, Long> implements MoudelDao {

	@SuppressWarnings("unchecked")
	public List<Moudel> findMoudelByParent(String parent) {
		String hql = "from Moudel a where a.parent =:parent";
		Query query = getSession().createQuery(hql);		
		query.setString("parent", parent);
		query.setCacheable(true);
		query.setCacheMode(CacheMode.GET);
		return query.list();
	}

}
